
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>后台</title>

    <link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/icheck/all.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-datetimepicker.css" />

</head>

<body>

<include file="Common/topNav" />

<div class="container-fluid">
    <div class="row">
        <include file="Common/leftMenu" />
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main mg-main">
            <div class="cont-title clearfix">
                <div class="title">会议预约信息</div>
                <div class="btn-group">
                    <button class="btn" type="button" id="meetGrid">添加</button>
                   <!-- <button class="btn" type="button" id="del_space">删除</button>-->
                </div>
            </div>
            <form class="jc-search form-inline" action="{:U('Admin/Space/Meeting/meetingGrid')}" method="post">

                <div class="form-group">
                    <label>时间选择:</label>
                    <input  id='datetimepicker1' type='text'  value="{$dayTime}" name="date_time" class="form-control" data-date-format="yyyy-mm-dd" />
                </div>
                <div class="form-group">
                    <label>地点选择:</label>
                    <select class="form-control" name="room_id">
                        <volist name="rooms" id="item">
                            <option value="{$item.id}" <if condition="$item.id eq $room_id">selected</if>>{$item.name}</option>
                        </volist>
                    </select>
                </div>
                <input class="btn" type="submit" value="搜索" />
            </form>
			<div style="margin-right:17px;">
				<table class="table-tit">
					<tbody>
						<tr>
							<th></th>
							<th>{$roomName}</th>
						</tr>
					</tbody>
				</table>
			</div>
			<div style="position: absolute;top:181px;bottom: 0;right: 40px;left: 40px;overflow-y: scroll;" id="booking_div">
				<table cellpadding="0" cellspacing="0"  class="table-cont" id="tableData">
					<tbody>
						<volist name="dayHours" id="item">
                            <tr id="tr_{$item.hour|substr=0,2}">
                                <td class="time">{$item.hour}</td>
								<td class="schedule <if condition="$item['border_td']">booked</if>" title="{$item.booking.name}">
                                    <volist name="item.minitus" id="min">
                                        <if condition="$min['checked']">
                                            <if condition="$min['first']">
                                            <div class="hover first-cell">
                                                <img src="__ROOT__{$min.booking.logo}" class="mg-logo">
                                                <span style="margin-left:10px;">{$min.booking.team.team_name}({$min.booking.start_time|date='H:i',###} - {$min.booking.end_time|date='H:i',###})</span>
                                            </div>
                                            <else/>
                                            <div class="hover">&nbsp;</div>
                                            </if>
                                        <else/>
                                            <div>&nbsp;</div>
                                        </if>
                                    </volist>
								</td>
							</tr>
                    	</volist>
					</tbody>
				</table>
            </div>
        </div>
    </div>
</div>
<!--<if condition="$min['first']">
                                       <div class="hover first-cell" >{$item.booking.team.team_name}{$item.booking.start_time|date='H:i',###} - {$item.booking.end_time|date='H:i',###}}</div>
                                   <else/>
                                       <div class="hover"></div>
                                   </if>-->

<include file="Common/modalHtmls" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/icheck.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript">
    $('#datetimepicker1').datetimepicker({
        format: 'yyyy-mm-dd',
        language: 'ch',
        pickDate: true,
        pickTime: false,
        autoclose:true,
        minView:2,
        //pickerPosition:"bottom-left"
    });
    $(function(){
        $("#meetGrid").bind("click",addmeetGrid);
        $("#tableData .meet_edit").click(function(){
            editSpace(this);
        });
        $("#tableData .space_del").click(function(){
            delSpace(this);
        });
        toAnchor();
    });

    function addmeetGrid(){
        common.loading('正在加载...');
        common.htmlAjax("{:U('Admin/Space/Meeting/add')}", {}, function (html) {
            common.closeLoading();
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        });
    }

    function showSpace(obj){
        var id = $(obj).attr("thisId");
        common.loading('正在加载...');


        common.htmlAjax("{:U('Admin/Space/Spaces/detail')}", {id:id}, function (html) {
            common.closeLoading();
            $("#commonModal").html(html).modal('toggle');
        });
    }

    function editSpace(obj){
        var id = $(obj).attr("thisId");
        common.loading('正在加载...');
        common.htmlAjax("{:U('Admin/Space/Spaces/add')}", {id:id}, function (html) {
            common.closeLoading();
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        });
    }

    //定位到正常工作时间
    function toAnchor() {
        var tab = $("#booking_div");
        var scrollTo = $("#tr_08");
        tab.scrollTop(scrollTo.offset().top - tab.offset().top+tab.scrollTop());
    }

</script>
</body>
</html>
